# Mulan Permissive Software License£¬Version 2
#
# Mulan Permissive Software License£¬Version 2 (Mulan PSL v2)
#
# January 2020 http://license.coscl.org.cn/MulanPSL2
# 
# Copyright (c) 2024 BerryFox
# L.M.F. is licensed under Mulan PSL v2.
# You can use this software according to the terms and conditions of the Mulan
# PSL v2.
# You may obtain a copy of Mulan PSL v2 at:
#          http://license.coscl.org.cn/MulanPSL2
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY
# KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
# NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
#
import pygame
from pygame.locals import *
import sys

from mods.easyprint import print_text,PrintSpecial
from mods.settings import Settings

settings=Settings()
printspecial = PrintSpecial()
#Contro print
a=0

#main
pygame.init()
clock = pygame.time.Clock()
screen = pygame.display.set_mode((settings.screen_width, \
    settings.screen_height))
pygame.display.set_caption("Light Mirror Flag(L.M.F) v1.0")

screen.fill(settings.bg_color)

#init Sound
try:
    pygame.mixer.init()
    bg_sound = pygame.mixer.Sound("sounds/bg_sound.ogg")
    bg_channel = pygame.mixer.find_channel(True)
    bg_channel.play(bg_sound,-1)
except:
    printspecial.print_error_text(error_text="Init sound error!", target=screen)
    settings.can_use_sounds = False

printspecial.print_game_name(target=screen)
print_text(x=1000, y=700, size=20, _font=None, shadow=False, \
           text="Press enter to countinue...", target=screen)

keys = pygame.key.get_pressed()
if keys[K_RETURN]:
    printspecial.print_about_studio(target=screen)
    print_text(x=1000, y=700, size=20, _font=None, shadow=False, \
           text="Press enter to countinue...", target=screen)

# mods.user.login_and_register()

# main loop
while True:
    for event in pygame.event.get():
        if event.type == QUIT:
            sys.exit()
        elif event.type == KEYDOWN:
            if event.key == pygame.K_ESCAPE:
                sys.exit()
            elif event.key == pygame.K_RETURN:
                if a == 0:
                    printspecial.print_about_LMF(target=screen)
                    print_text(x=1000, y=700, size=20, _font=None, shadow=False, \
                        text="Press enter to countinue...", target=screen)
                    a += 1
                elif a == 1:
                    printspecial.print_about_studio(target=screen)
                    print_text(x=1000, y=700, size=20, _font=None, shadow=False, \
                        text="Press enter to countinue...", target=screen)
                    a += 1
                elif a == 2:
                    printspecial.print_about_members(target=screen)
                    print_text(x=1000, y=700, size=20, _font=None, shadow=False, \
                        text="Press enter to countinue...", target=screen)
                    a += 1
                elif a == 3:
                    printspecial.print_thanks(target=screen)
                    print_text(x=1000, y=700, size=20, _font=None, shadow=False, \
                        text="Press ESC to quit...", target=screen)
                    a += 1

    screen.fill(settings.bg_color)

    clock.tick(60)

    # pygame.display.update()